#ifndef _QANSIEDITOR_H
#define _QANSIEDITOR_H


#define QAE_APP_NAME        "QAnsiEditor"
#define QAE_INTERNAL_NAME   "qansieditor"

#define QAE_VERSION         "0.1.0.0"
#define QAE_VER_MAJOR       0
#define QAE_VER_MINOR       1
#define QAE_VER_REVISION    0


/*
 * Whether we want to enable term-specific code.
 * The line separator and other platform-specific issue may be different.
 */
//#define _USE_TERM


/*
 * bit 0-2: foreground
 *  0: dark gray
 *  1: red
 *  2: green
 *  3: yellow
 *  4: blue
 *  5: magenta
 *  6: cyan
 *  7: white
 * bit 4-6:	background
 *  0: black
 *  1: dark red
 *  2: dark green
 *  3: dark yellow
 *  4: dark blue
 *  5: dark magenta
 *  6: dark cyan
 *  7: gray
 * bit 3: reserved
 * bit 7: reserved
 */

/* Mask for color */
#define MASK_FG         0x07
#define MASK_BG         0x70
/* Make color */
#define FG(fg)          ( (fg) & MASK_FG )
#define BG(bg)          ( ( (bg) << 4 ) & MASK_BG )
/* Retrieve color */
#define GETFG(c)        ( (c) & MASK_FG )
#define GETBG(c)        ( ( (c) & MASK_BG ) >> 4 )
/* Normalize color */
#define COLOR(c)        ( FG( GETFG(c) ) | BG( GETBG(c) ) )
/* Reverse color */
#define REVERSECOLOR(c) ( BG( GETFG(c) ) | FG( GETBG(c) ) )

/* Mask for effect */
#define MASK_BOLD       0x01
#define MASK_FAINT      0x02
#define MASK_ITALIC     0x04
#define MASK_UNDERLINE  0x08
#define MASK_BLINK      0x10
#define MASK_RAPIDBLINK 0x20
#define MASK_REVERSE    0x40
#define MASK_INVISIBLE  0x80

/* Default color and effect */
#define DEFAULT_COLOR   0x07
#define DEFAULT_EFFECT  0x00

/* Ctrl mask */
#define CTRL(c)         ( (c) & 0x1f )


#endif	// _QANSIEDITOR_H
